package com.hejian.android.a72ggametools.imageloader;

import android.graphics.Bitmap;

/**
 * Created by Administrator on 2016/1/11.
 */
public class DoubleCache implements ImageCache {
    ImageCache memoryCache = new MemoryCache();
    ImageCache diskCache = new DiskCache();

    @Override
    public Bitmap getBitmap(String urlStr) {
        Bitmap bitmap = memoryCache.getBitmap(urlStr);
        if (bitmap == null){
            bitmap = diskCache.getBitmap(urlStr);
        }
        return bitmap;
    }

    @Override
    public void setImage(String urlStr, Bitmap bitmap) {
        memoryCache.setImage(urlStr,bitmap);
        diskCache.setImage(urlStr,bitmap);
    }
}
